Current sensing#11
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a driver for the ACS3704x-010B3 current sensor and implements core current sensing functionality for the PDU Mk1, including offset collection and reading routines. Feedback highlights a critical naming inconsistency between the source and header files for the offset variable, which will cause linker errors. Other improvements suggested include correcting copy-pasted documentation, averaging multiple samples for more stable calibration, replacing hardcoded channel mapping with descriptive constants, and investigating a "magic delay" in the test code to resolve potential race conditions.
| #define ACS3704x_010B3_V_QVO 1.65 // V, quiescent output voltage (no current) | ||
| #define ACS3704x_010B3_SENSITIVITY 0.132 // V/A, output voltage increase per amp |
There was a problem hiding this comment.
add f to floating point constants to prevent clock cycle waste?
| for(uint8_t sample = 0; sample < CURRENT_SENSING_OFFSET_CALC_NUMSAMPLES; sample++) | ||
| { | ||
| current_adc_v_offset[ch] += -1.0*adc_results_sns1[sample][(ADS131M08Q1_NUM_CHANNELS-1)-ch]; | ||
| current_adc_v_offset[ADS131M08Q1_NUM_CHANNELS+ch] += -1.0*adc_results_sns0[sample][(ADS131M08Q1_NUM_CHANNELS-1)-ch]; |
No description provided.